use std::ops::Deref;

struct MySmartPointer<T>(T);

impl<T> MySmartPointer<T> {
    fn new(x: T) -> MySmartPointer<T> {
        MySmartPointer(x)
    }
}

impl<T> Deref for MySmartPointer<T> {
    type Target = T;

    fn deref(&self) -> &T {
        &self.0
    }
}

struct User {
    name: &'static str,
}

impl User {
    fn name(&self) {
        println!("{:?}", self.name);
    }
}

#[test]
fn it_works() {
    let u = User { name: "Alex" };
    let y = MySmartPointer::new(u);
    assert_eq!("Alex", y.name);
}
